package org.mch.func.sys.func;

import java.awt.event.MouseEvent;

import org.mch.biz.cons.ConsBtn;
import org.mch.biz.ui.BizEvent;
import org.mch.biz.ui.BizPanel;
import org.mch.func.entity.MFuncEO;
import org.mch.swingm.core.MButton;

/**
 * 描述：编码操作工具事件；
 * 
 * @author MCHUN；
 * 
 */
public class SysFuncPanelEvent extends BizEvent {
	private static final long serialVersionUID = 1L;

	public SysFuncPanelEvent(BizPanel panel) {
		super(panel);
	}

	protected void buttonClicked(MouseEvent e) throws Exception {
		MButton mbtn = (MButton) e.getSource();
		switch (mbtn.getIdentify()) {
			case ConsBtn.add: {
				onAdd();
				break;
			}
			case ConsBtn.edit: {
				onEdit();
				break;
			}
			case ConsBtn.save: {
				onSave();
				break;
			}
		}
	}

	protected void onAdd() {
		getPanel().setItemValue("funcid", System.nanoTime());
		getPanel().setItemValue("hinttext", null);
		getPanel().setItemValue("memo", null);
		getPanel().setItemValue("classname", null);
		getPanel().setItemValue("nodename", null);
		getPanel().setItemValue("ordercode", null);
	}

	protected void onEdit() {
	}

	protected void onSave() {
		
		MFuncEO eo = getPanel().getFormUIData();
		
		System.out.println(eo.getClassname());
	}

	public SysFuncPanel getPanel() {
		return (SysFuncPanel) super.getPanel();
	}
}